Few pointers when learning Python

  • Play around in the python/ipython shell
  • The dir function is very handy when you want to see the set of available methods on an object
  • To get help about any function or object, use the help command in the python shell.
  • If using the ipython shell or jupyter notebook, you can also get help by typing a ? next to the object name
  • Use ?? to get the complete source code of the function
  • Don't forget to properly indent your code, use an editor which can do auto indent for you.

Next steps

  • Defining Classes
  • File handling
  • Learning about modules and packages
  • What's there in the Python standard library
  • Debugging in Python
  • Pickling
  • Accessing Databases
  • Creating and publishing your own Python module
  • Applications: web applications, data science, web scraping, network analysis

A Flavor of the Beauty of Python

Doing http requests in Python


In [ ]:
import requests
resp = requests.get('https://api.stackexchange.com/2.2/questions?order=desc&sort=activity&site=stackoverflow')
print resp.status_code
print resp.content

File handling in Python


In [ ]:
with open('/home/abhinav/apropos.c.diff', 'r') as f:
    for line in f:
        print line

In [ ]: